do "E:/ReplicateBuild/02_code/00_environment/00_set_environment.do"


use "$basedata/va_estimates_drift", clear

keep if s!=.
/*
How frequently do teachers teach meaningful mixes of low and high economically advantaged students?  What does the distribution of teacher-level shares of disadvantaged students look like?
*/

histogram p_m2_ma if lea_ma=="XXX", fraction width(.1) xtitle("Fraction of teacher's students that are economically disadvantaged") // hide identity
graph export "$output/figures/teacher_frac_dis.png", as(png) replace


/*
School of higher vs. lower VA teachers: share of disadvantaged students
*/

keep if lea_ma=="XXX" // hide identity
collapse (mean) school_year_meanVA=mu_jt_hat_preY_ma p_m2_ma mu_jt_m1_hat_preY_ma mu_jt_m2_hat_preY_ma (sum) n_ct_m1_ma n_ct_m2_ma, by(s t)

gen totn = n_ct_m1_ma + n_ct_m2_ma

qui reg p_m2_ma school_year_meanVA [aw=totn], vce(cluster s)
local b=_b[school_year_meanVA]
local b: display %4.2f `b'
local se=_se[school_year_meanVA]
local se: display %4.2f `se'
binscatter p_m2_ma school_year_meanVA [aw=totn], xtitle("School-Year Mean Teacher VA") ytitle("Fraction Disadvantaged") text(.55 .15 "slope: `b' (`se')")
graph export "$output/figures/binscatter_schoolyrteacherva_fracdis.png", as(png) replace

qui reg p_m2_ma mu_jt_m1_hat_preY_ma [aw=totn], vce(cluster s)
local b=_b[mu_jt_m1_hat_preY_ma]
local b: display %4.2f `b'
local se=_se[mu_jt_m1_hat_preY_ma]
local se: display %4.2f `se'
binscatter p_m2_ma mu_jt_m1_hat_preY_ma [aw=totn], xtitle("School-Year Mean Teacher VA Advantaged Students") ytitle("Fraction Disadvantaged") text(.55 .15 "slope: `b' (`se')")
graph export "$output/figures/binscatter_schoolyrteacherva1_fracdis.png", as(png) replace

qui reg p_m2_ma mu_jt_m2_hat_preY_ma [aw=totn], vce(cluster s)
local b=_b[mu_jt_m2_hat_preY_ma]
local b: display %4.2f `b'
local se=_se[mu_jt_m2_hat_preY_ma]
local se: display %4.2f `se'
binscatter p_m2_ma mu_jt_m2_hat_preY_ma [aw=totn], xtitle("School-Year Mean Teacher VA Disdvantaged Students") ytitle("Fraction Disadvantaged") text(.55 .15 "slope: `b' (`se')")
graph export "$output/figures/binscatter_schoolyrteacherva2_fracdis.png", as(png) replace

